/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package com.querie.Algos;

import com.querie.Voldemort.VoldemortH;
import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.PreparedStatement;
import java.sql.ResultSet;

/**
 *
 * @author  Naushin 
 */
public class ItemSimilarity {
       public void putValue(int i, int j,double jaccard){
             Connection conn = null;
    String url = "jdbc:mysql://localhost:3306/";
    String dbName = "querie";
    String driver = "com.mysql.jdbc.Driver";
    String userName = "root";
    String password = "root";
    String strSQL1 = "";
    String strSQL2="";



        ResultSet rs0 = null;
       PreparedStatement stmt = null;


  try{
      Class.forName(driver).newInstance();
      conn = DriverManager.getConnection(url+dbName,userName,password);
      System.out.println("Connected to the database");

           stmt = conn.prepareStatement(
          "update itemsimilarity SET simiValue = ? where item1 = ? and item2 = ?");

       stmt.setDouble(1, jaccard);
        stmt.setInt(2, i);
        stmt.setInt(3,j);
        stmt.executeUpdate();

        stmt.close();
        conn.close();
        System.out.println("connection closed");

           //  rs0 = stmt.executeQuery(strSQL1);
           }catch(Exception ex){ex.printStackTrace();}
       
       }
       public static void main(String args[]){
       VoldemortH v=new VoldemortH();
     //  for(i=0;)
       v.getValue(null, null);

       }
}
